#include "StdAfx.h"
#include "ImageCopy.h"


CImageCopy::CImageCopy(void)
{
}


CImageCopy::~CImageCopy(void)
{
}

HICON CImageCopy::CloneHICON(HICON hIcon)
{
    if (hIcon == NULL)
    {
        return NULL;
    }

    ICONINFO icInfo = {0};
    if (!::GetIconInfo(hIcon, &icInfo))
    {
        return NULL;
    }

    HICON hCopy = ::CreateIconIndirect(&icInfo);

    ::DeleteObject(icInfo.hbmColor); 
    ::DeleteObject(icInfo.hbmMask);  

    return hCopy;
}